/*
*   Created by Standard Generator beta version.
*   Created Date Fri Jun 20 13:07:10 GMT+07:00 2003
*/

package com.epro.standard.usermenu;

import java.util.Vector;

import com.epro.standard.infrastructure.root.KeywordElement;
import com.epro.standard.infrastructure.root.StdKeyword;

public class ProgramGroupKeyword extends StdKeyword {
    public ProgramGroupKeyword() {
        super();
        addElement("PROGRAM_GROUP", "PG", "PROGRAM_GROUP_ID", "String", true);
        addElement("PROGRAM_GROUP", "PG", "PROGRAM_GROUP_DESC", "String", 
                   true);
        addElement("PROGRAM_GROUP", "PG", "ACTIVE", "String", true);
        addElement("PROGRAM_GROUP", "PG", "UPD_BY", "String", true);
        addElement("PROGRAM_GROUP", "PG", "UPD_DATE", "Timestamp", true);
    }

    private void addElement(String tableName, String aliasName, 
                            String columnName, String type, boolean isMain) {
        elements.put(aliasName + "." + columnName, 
                     new KeywordElement(tableName, aliasName, columnName, type, 
                                        isMain));
    }

    public KeywordElement getPG_programGroupID() {
        return (KeywordElement)elements.get("PG.PROGRAM_GROUP_ID");
    }

    public KeywordElement getPG_programGroupDesc() {
        return (KeywordElement)elements.get("PG.PROGRAM_GROUP_DESC");
    }

    public KeywordElement getPG_active() {
        return (KeywordElement)elements.get("PG.ACTIVE");
    }

    public KeywordElement getPG_updBy() {
        return (KeywordElement)elements.get("PG.UPD_BY");
    }

    public KeywordElement getPG_updDate() {
        return (KeywordElement)elements.get("PG.UPD_DATE");
    }

    public void setJoin(boolean join, boolean isPKJoin) {
        if (join) {
            isJoin = true;
        } else {
            mainCondition.clearPKCondition();
            isJoin = false;
        }
    }

    public Vector getReturnVO(java.sql.ResultSet rs) {
        Vector returnVector = new Vector();
        try {
            while (rs.next()) {
                returnVector.addElement(new ProgramGroupVO((isColumnInResultSet("PG_PROGRAM_GROUP_ID", 
                                                                                rs)) ? 
                                                           rs.getString("PG_PROGRAM_GROUP_ID") : 
                                                           null, 
                                                           (isColumnInResultSet("PG_PROGRAM_GROUP_DESC", 
                                                                                rs)) ? 
                                                           rs.getString("PG_PROGRAM_GROUP_DESC") : 
                                                           null, 
                                                           (isColumnInResultSet("PG_ACTIVE", 
                                                                                rs)) ? 
                                                           rs.getString("PG_ACTIVE") : 
                                                           null, 
                                                           (isColumnInResultSet("PG_UPD_BY", 
                                                                                rs)) ? 
                                                           rs.getString("PG_UPD_BY") : 
                                                           null, 
                                                           (isColumnInResultSet("PG_UPD_DATE", 
                                                                                rs)) ? 
                                                           rs.getTimestamp("PG_UPD_DATE") : 
                                                           null));
            }
        } catch (java.sql.SQLException sqle) {
            sqle.printStackTrace();
        }
        return returnVector;
    }

    public void addCriteria(KeywordElement ke, String value) {
        addCommonCriteria(ke, value);
    }
}
